perm filename GALLEY.TEX[TEX,DEK]10 blob sn#723340 filedate 1983-08-20 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00004 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	%\read16 to\pagenumber
C00003 00003	\ninepoint
C00012 00004	% now we print the answers, if any
C00013 ENDMK
C⊗;
%\read16 to\pagenumber
\input manmac
\tenpoint
\pageno=800
%\pageno=\pagenumber
\def\rhead{Experimental Pages for The \TeX book}
\def\chapno{ X}
{\catcode`\%=12 \immediate\write\ans{% Answers for galley proofs:}}
\ninepoint

The indexing macros of |manmac| produce entries of four kinds, which are
assigned to codes 0,~1, 2, and~3. Code~0 applies when the argument is enclosed
in braces, e.g., `|↑{word}|'\thinspace; code~1 applies when the argument
is enclosed in vertical lines and there's no backslash, e.g.,
`|↑|\||plus|\|'\thinspace; code~2 is similar but with a backslash, e.g.,
`|↑|\||\par|\|'\thinspace; code~3 applies when the argument is enclosed in
angle brackets, e.g., `|↑\<stuff>|'.  The four example entries in the previous
sentence will be written on file |index.tex| in the form\strut
\begintt
word !0 123.
plus !1 123.
par !2 123.
stuff !3 123.
|kern-3pt
\endtt
if they appear on page 123 of the book.
\beginlines
|\chardef\bslash=`\\ % \bslash makes a backslash (in tt fonts)|
|\def\xref{\futurelet\next\xrefswitch} % branch on the next character|
|\def\xrefswitch{\ifx\next|\||\let\next=\vxref|
|  \else\ifx\next\<\let\next=\anglexref|
|    \else\let\next=\normalxref \fi\fi \next}|
|\def\vxref|\||{\catcode`\\=\active \futurelet\next\vxrefswitch}|
|\def\vxrefswitch#1|\||{\catcode`\\=0|
|  \ifx\next\empty\def\xreftype{2}%|
|    \def\next{{\tt\bslash\text}}% code 2, |\||\arg|\|
|  \else\def\xreftype{1}\def\next{{\tt\text}}\fi % code 1, |\||arg|\|
|  \edef\text{#1}\makexref}|
|{|↑|\catcode||`\|\||=0 \catcode`\\=\active |\||gdef\{}}|
|\def\anglexref\<#1>{\def\xreftype{3}\def\text{#1}%|
|  \def\next{\<\text>}\makexref} % code 3, \<arg>|
|\def\normalxref#1{\def\xreftype{0}\def\text{#1}\let\next=\text\makexref}|
\endlines

Indexing is suppressed unless the |proofmode| switch is set to true,
since material is gathered for the index only during trial runs---not
on the triumphant occasion when the book is finally being printed.
\beginlines
|\newswitch{proofmode}|
|\proofmodetrue % this should be false when making camera-ready copy|
|\def\makexref{\ifproofmode\insert\margin{\hbox{\marginstyle\text}}%|
|   |↑|\xdef||\writeit{|↑|\write||\inx{\text\space!\xreftype\space|
|     |↑|\noexpand|↑|\number||\pageno.}}\writeit|
|   \else\ifhmode\kern0pt \fi\fi|
|  \ifsilent|↑|\ignorespaces||\else\next\fi}|
\endlines
(The ↑|\insert| suppresses ↑{hyphenation} when proofs are being checked;
a ↑|\kern||0pt| is therefore emitted to provide consistent behavior
in the other case.)

The material that accumulates on file |index.tex| gives a good first
approximation to an index, but it doesn't contain enough information to do
the whole job; a topic often occurs on several pages, but only the first
of those pages is typically listed in the file.  The author ↑↑{Knuth}
prefers not to generate indexes automatically; he likes to reread his
books as he checks the cross-references, thereby having the opportunity to
rethink everything and to catch miscellaneous errors before it is too
late. As a result, his books tend to be delayed, but the indexes tend to
be pretty good.  Therefore he designed the indexing scheme of |manmac| to
provide only the clues needed to make a real index. On the other hand,
it would be possible to extend the macros above and to obtain a comprehensive
system that generates an excellent index with no subsequent human intervention;
see, for example, ``An indexing facility for \TeX'' by Terry ↑{Winograd}
and Bill ↑{Paxton}, in {\sl ↑{TUGboat}\/ \bf1} (1980), A1--A12.

The |manmac| macros have now been fully presented; we shall close this
appendix by presenting one more example of their use. Chapter~27 mentions
the desirability of creating a long book in small parts, by using a
``↑{galley}'' file. The author adopted that strategy for {\sl The \TeX
book}, entering each chapter into a small file |galley.tex| that looked like this:
\beginlines
|\input manmac|
|\tenpoint|
|\pageno=800|
|\def\rhead{Experimental Pages for The \TeX book}|
|\def\chapno{ X}|
|{\catcode`\%=12 \immediate\write\ans{% Answers for galley proofs:}}|
\qquad\vdots
\<new text being tested, usually an entire chapter>
\qquad\vdots
| |
|% that blank line will stop an unfinished \answer|
|\immediate\closeout\ans|
|\vfill\eject|
|\ninepoint \input answers % typeset the new answers, if any|
|\bye|
\endlines

\endchapter

It is much easier to use macros than to define them.
$\ldots$
The use of macro libraries, in fact, mirrors almost exactly
the use of subroutine libraries for programming languages.
There are the same levels of specialization,
from publicly shared subroutines
to special subroutines within a single program,
and there is the same need for a programmer
with particular skills to define the subroutines.
\author PETER ↑{BROWN}, {\sl Macro Processors\/} (1974) % p10

\bigskip

The ↑{epigraph} is among the most delightful of scholarly habits.
Donald ↑{Knuth}'s work on fundamental algorithms would be
just as important if he hadn't begun with a quotation
from Betty ↑{Crocker}, but not so enjoyable.
Part of the fun of an epigraph is turning a source to an unexpected use.
\author MARY-CLAIRE ↑{VAN LEUNEN}, {\sl A Handbook for Scholars\/} (1978)
 % page 53. [But it was McCall's, not Betty Crocker]

\eject
% now we print the answers, if any

% that blank line will stop an unfinished \answer
\immediate\closeout\ans
\vfill\eject
\ninepoint
\input answers
\bye